#!/bin/bash
#文件名： addNewConfig.sh
#用途：在对应的XML中添加新的配置信息
if [ $# -lt 1 ];
then
	echo 用法：$0 合集代号
	exit 1
fi
cp /usr/share/gnome-background-properties/xenial-wallpapers.xml temp.xml	#复制到当前目录下
head -n -1 temp.xml > temp1.xml	#将原有配置文件直接复制到临时文件
echo ' <wallpaper deleted="false">' >>temp1.xml
echo "  <name>$1</name>" >> temp1.xml
echo "  <filename>/usr/share/backgrounds/contest/$1.xml</filename>" >> temp1.xml
echo '  <options>zoom</options>' >> temp1.xml
echo ' </wallpaper>' >> temp1.xml
echo '</wallpapers>'>> temp1.xml
rm temp.xml
mv temp1.xml /usr/share/gnome-background-properties/xenial-wallpapers.xml
